package test.Thread;

import test.Carre;
import test.Couleur;

public class MyThread implements Runnable{

	private Carre carre;
	private int wait;
	public MyThread(Carre carre, int wait)
	{
		this.wait = wait;
		this.carre = carre;
	}
	
	@Override
	public void run() {
		try {
			this.wait(wait);
			carre.setCouleur(new Couleur("Blue"));
			try {
				carre.deplacerHaut();
				carre.getCouleur().setMyCouleur("Green");
			} catch (Throwable e) {
				System.out.println("Reflect ne catch pas l'erreur");
			}
		} catch (InterruptedException e) {
			
			e.printStackTrace();
		}
	}

}
